import { ElMessage } from 'element-plus'
function checkPhone(value: string): boolean {
    var reg = new RegExp(/^[1][3,4,5,7,8][0-9]{9}$/)
    return reg.test(value)
}
export function useCheckEmpty(formData: any): boolean {
    if (formData.patientName === '') {
        ElMessage({
            message: '请输入患者姓名',
            type: 'warning'
        })
        return false
    } else if (formData.phone === '') {
        ElMessage({
            message: '请输入手机号',
            type: 'warning'
        })
        return false
    } else if (!checkPhone(formData.phone)) {
        ElMessage({
            message: '请输入正确的手机号',
            type: 'warning'
        })
        return false
    } else if (formData.gender === '') {
        ElMessage({
            message: '请选择性别',
            type: 'warning'
        })
        return false
    } else if (formData.birth === '') {
        ElMessage({
            message: '请输入出生日期',
            type: 'warning'
        })
        return false
    } else if (formData.education === '') {
        ElMessage({
            message: '请选择文化程度',
            type: 'warning'
        })
        return false
    } else if (formData.hospitalId === '') {
        ElMessage({
            message: '请选择医院',
            type: 'warning'
        })
        return false
    } else {
        return true
    }
}